package com.doule.farmerassistant.plan;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * PlanDetail entity class.
 * 
 * @author riguang
 * 
 */
public class PlanDetail {
    /**
     * Plan id.
     */
    private String mPlanId;
    /**
     * Plan name.
     */
    private String mPlanName;
    /**
     * User account.
     */
    private String mAccount;
    /**
     * Task ids belong this plan.
     */
    private JSONArray mTaskIds;
    /**
     * Task name belong this plan.
     */
    private JSONArray mTaskNames;
    /**
     * Plan start time.
     */
    private int mStartTime;
    /**
     * Excute plan day.
     */
    private int mDay, mDayType, mState;

    // private boolean isChecked;

    // public PlanDetail(final String type, final String id, final String name,
    // final String batchType, final String duration) {
    // mPlanId = type;
    // mPlanName = id;
    // mAccount = name;
    // mStartTime = duration;
    // }

    /**
     * Constructor.
     * 
     * @param js
     *            JSONObject
     */
    public PlanDetail(final JSONObject js) {
        try {
            mPlanId = js.getString("PlanId");
            mPlanName = js.getString("PlanName");
            mAccount = js.getString("Account");
            mStartTime = js.getInt("StartTime");
            mTaskIds = js.getJSONArray("TaskIds");
            mTaskNames = js.getJSONArray("TaskNames");
            mDay = js.getInt("Day");
            mDayType = js.getInt("DayType");
            mState = js.getInt("State");
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     * Get day.
     * 
     * @return mDay
     */
    public int getDay() {
        return mDay;
    }

    /**
     * Get day type.
     * 
     * @return mDayType
     */
    public int getDayType() {
        return mDayType;
    }

    /**
     * Get state.
     * 
     * @return mState
     */
    public int getState() {
        return mState;
    }

    /**
     * Get plan id.
     * 
     * @return mPlanId
     */
    public String getPlanID() {
        return mPlanId;
    }

    /**
     * Get plan name.
     * 
     * @return mPlanName
     */
    public String getPlanName() {
        return mPlanName;
    }

    /**
     * Get user account.
     * 
     * @return mAccount
     */
    public String getAccount() {
        return mAccount;
    }

    /**
     * Get task ids belong plan.
     * 
     * @return mTaskIds
     */
    public JSONArray getTaskIds() {
        return mTaskIds;
    }

    /**
     * Get task names.
     * 
     * @return mTaskNames
     */
    public JSONArray getTaskNames() {
        return mTaskNames;
    }

    /**
     * Get start time.
     * 
     * @return mStartTime
     */
    public int getStartTime() {
        return mStartTime;
    }

    // /**
    // *
    // * @return
    // */
    // public boolean isChecked() {
    // // TODO Auto-generated method stub
    // return isChecked;
    // }
    //
    // /**
    // * Set check.
    // * @param b
    // */
    // public void setChecked(boolean b) {
    // // TODO Auto-generated method stub
    // isChecked = b;
    // }
}
